package com.eight.homepage.controller;

import com.eight.common.pojo.TbArticle;
import com.eight.common.vo.Result;
import com.eight.homepage.service.ArticleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 向文豪
 * @program: eight-education-parent
 * @description:
 * @date 2023/5/30 18:36
 */
@RestController
@RequestMapping("/home/article")
@Api(tags = "文章显示")
public class ArticleController {
    @Autowired
    private ArticleService articleService;

    @ApiOperation("文章管理")
    @PostMapping("/getArticleByNavId")
    public Result getArticle(@RequestBody TbArticle tbArticle){
        TbArticle article= articleService.findAll(tbArticle.getNavId());
        return Result.success(article);
    }

    @ApiOperation("文章修改")
    @PostMapping("/updateArticleByNavId")
    public Result updateArticleByNavId(@RequestBody TbArticle article){
       int article1 = articleService.updateArticle(article);
       return Result.success();
    }
}
